package com.ap.core.dao.impl;

import javax.persistence.EntityManager;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;

import com.ap.core.dao.AbstractAPCoreBaseJpaDao;
import com.ap.core.dao.OrderPaymentRefundDao;
import com.ap.core.domain.OrderPaymentRefund;

/**
 * User: Ranjit.Singh
 * Jpa Implementation class for {@link com.ap.core.dao.OrderPaymentDao}
 */
public class JpaOrderPaymentRefundDao extends AbstractAPCoreBaseJpaDao<OrderPaymentRefund, String> implements OrderPaymentRefundDao{

    @Override
    public OrderPaymentRefund findById(String primaryKey) {
        return findById(OrderPaymentRefund.class, primaryKey);
    }

    @Override
    public EntityManager getEntityManager() {
        return entityManager;
    }

    @Override
	public OrderPaymentRefund getReadOnlyRefundByOrderTransactionId(String apTranId) {
		final Criteria criteria = getSession().createCriteria(OrderPaymentRefund.class);
        criteria.add(Restrictions.eq("orderTransactionId", apTranId));
        criteria.setReadOnly(true);
        return (OrderPaymentRefund)criteria.uniqueResult();
	}
   
    
    
  

}
